All Questions
130 questions
0votes
1answer
49views
How to connect the model to the local Microsoft database? (C# Razor MVC structure - MVS editor)
(self learning here) I'm trying to make a simple website where users can request to change their passwords. There is a page for users' input. I want their input to be stored into the database. I made ...
0votes
1answer
355views
cannot get parameters from ajax call to controller razor
Simple usecase - get PartialView dynamically from AJAX call to update div in my main page after input select (dropdownlist) changed value. Steps I took: Created view (only, wihtout PageModel) with ...
0votes
1answer
227views
How to use @ in ASp.net MVC views for another purposes not coding with backend
I want to add the social media links to my html. My project is implemented using ASP.net MVC. When I add the below code it gives an error in this line: "@context" : "http://schema.org&...
0votes
2answers
390views
Getting data from Json returned by controller action
I have a modal that I am trying to populate via sending a modal through a JSON obj from a controller action. It seems to be returning the model just fine, however I am having a hard time extracting ...
2votes
0answers
291views
Using JSON in attribute of form tag created with Html.BeginForm
I need to populate an attribute of a form tag generated with Html.BeginForm with a JSON object. I can't find a way to get it to print the attribute value without encoding it. I have tried with and ...
1vote
1answer
431views
How to create single page search form with ajax in MVC Razor
I'm a beginner in the ways of MVC / Razor... Basically I have 2 pages just for showing a search result from an API that I'm consuming with Json. Index.cshtml: (Just a form) @model ConsultaInterna....
1vote
1answer
258views
Displaying a JSON in a table ASP.Net MVC
I have a JWT that I want to display its contents after signature validation. so, I verify the signature like this: var verified = JWT.Decode(token, publicKey); In this case, verified is a string ...
0votes
0answers
539views
How to pass a list of string to a javascript using Razor on ASP.NET MVC? [duplicate]
I am trying to pass a list of strings from the server-side to be used on client-side. I'm using Razor and ASP.NET MVC. In other part of my code, I could pass a list of integers. I declared a List<...
0votes
1answer
527views
How do I loop through the json object returned from the controller?
I am returning JSON result to the view from controller. I want to loop through it in RAZOR [HttpGet] public JsonResult Index() { return Json(GalleryRepository.getImages(), JsonRequestBehavior....
1vote
1answer
788views
How to render a JSON file using C# MVC
I need to render a JSON file in C# using MVC. I wrote In Controller public ActionResult Index() { List<string> Title = new List<string>(); using (StreamReader streamreader = ...
0votes
1answer
307views
How can I parse Json dates from a Razor model
I have a c# model that I am parsing into Json in my Razor view like this: @Html.Raw(Json.Encode(Model.myModel)) However part of myModel is a date that I need to insatiate as a Javascript date like so:...
0votes
2answers
2kviews
@Html.Raw - Line breaks missing when assigning to json object
I have the following code: data: { comment: { 'id': @Model.Id, 'description': "@Html.Raw(Model.Description)" }, }, But I get the ...
0votes
1answer
12kviews
How to return View with JSON result
Is there any way to return the View("controller", model) with JSON result? I've done like this(see code below) but it returns me an error. if (thereserror == true) { return Json(new ...
1vote
1answer
933views
How to return JSON by rendering razor syntax in to string
I am following the tutorial in which the instructor create a class for converting razor syntax to string which is right bellow . public static string RazorToString(Controller controller , string ...
4votes
3answers
3kviews
Dotnet compliation error; aspnetcore.mvc.razor.viewcompliation.rsp exited with code 1
I have the following issue in my API where the code is running ok when i try to run it in local host, however when i try to publish it, this error comes up Help!! Error The command ""dotnet" exec --...